<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <title>公司信息</title>
  <!-- 引入 Vue.js -->
  <script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
  <!-- 引入 Axios -->
  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
  <style>
    body {
      font-family: Arial, sans-serif;
      background-color: #f7f9fc;
      margin: 0;
      padding: 20px;
    }

    .container {
      max-width: 800px;
      margin: 0 auto;
      background-color: #fff;
      border-radius: 8px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
      padding: 30px;
    }

    h1 {
      margin-top: 0;
      font-size: 32px;
      color: #333;
      text-align: center;
      margin-bottom: 20px;
    }

    .info-item {
      margin-bottom: 20px;
      display: flex;
      align-items: center;
    }

    .info-label {
      flex: 1;
      font-weight: bold;
      color: #666;
      font-size: 18px;
    }

    .info-value {
      flex: 2;
      margin-left: 20px;
      color: #333;
      font-size: 18px;
    }
    #app {
      position: relative;
    }
    .company-avatar {
      position: absolute;
      bottom: 50px;
      right: 50px;
      max-width: 200px;
      max-height: 200px;
      border-radius: 50%;
    }

    .divider {
      border-bottom: 1px solid #ccc;
      margin-bottom: 30px;
    }
  </style>
</head>
<body>
<div id="app" class="container">
  <h1>公司信息</h1>
  <div class="divider"></div>
  <div class="info-item">
    <span class="info-label">公司ID:</span>
    <span class="info-value">{{ companyInfo.companyid }}</span>
  </div>
  <div class="info-item">
    <span class="info-label">公司名称:</span>
    <span class="info-value">{{ companyInfo.companyname }}</span>
  </div>
  <div class="info-item">
    <span class="info-label">公司地址:</span>
    <span class="info-value">{{ companyInfo.companyadress }}</span>
  </div>
  <div class="info-item">
    <span class="info-label">公司电话:</span>
    <span class="info-value">{{ companyInfo.companyphone }}</span>
  </div>
  <div class="info-item">
    <span class="info-label">公司邮箱:</span>
    <span class="info-value">{{ companyInfo.companyemail }}</span>
  </div>
  <div class="info-item">
    <span class="info-label">公司资产:</span>
    <span class="info-value">{{ companyInfo.companyasset }}元</span>
  </div>
  <div class="info-item">
    <img :src="getImageUrl(companyInfo.companyavatar)" alt="公司头像" class="company-avatar">
  </div>
</div>

<script>
  new Vue({
    el: '#app',
    data: {
      companyInfo: {}
    },
    mounted() {
      this.fetchCompanyInfo();
    },
    methods: {
      fetchCompanyInfo() {
        axios.get('/company/select')
                .then(response => {
                  this.companyInfo = response.data.data;
                })
                .catch(error => {
                  console.error('获取公司信息失败:', error);
                });
      }
      ,getImageUrl(profilepicture) {
        // 假设后端图片存储在 /imgs 目录下
        return `/images/${profilepicture}`;
      }
    }
  });
</script>

</body>
</html>
